<?php

namespace App\Exports;

use App\Models\FangOwners;

use Maatwebsite\Excel\Concerns\FromQuery;
use Maatwebsite\Excel\Concerns\Exportable;

class FangOwnersExport implements FromQuery
//继承接口类 必须继承里边的所有方法
{
    /**
    * @return \Illuminate\Support\Collection
    */

    use Exportable;

    protected $sex;
    protected $name;
    public function __construct($query)
    {
        $this->sex=$query['sex'];
        $this->name=$query['name'];
    }

    public function query()
    {
        return FangOwners::query()->where('sex',$this->sex)->where('name','like',"%$this->name%");
    }

    /* public function collection()
     {
         return FangOwners::all();
     }*/
}
